# encoding: utf-8
from google.appengine.api import users
from google.appengine.ext import db

class Category(db.Model):
	name = db.StringProperty(required=True)

class Article(db.Model):
	title = db.StringProperty(required=True)
	content = db.TextProperty(required=True)
	time_date = db.DateTimeProperty(auto_now_add=True)
	month_year = db.StringProperty()
	categories_keys = db.ListProperty(db.Key)
	article_type = db.StringProperty(default='draft',choices=['draft','article','page'])
	alert_emails = db.ListProperty(str)

class Comment(db.Model):
	article = db.ReferenceProperty(Article)
	time_date = db.DateTimeProperty(auto_now=True)
	user = db.UserProperty()
	nickname = db.StringProperty()
	content = db.TextProperty()
	url = db.StringProperty()

class Image(db.Model):
	content = db.BlobProperty()

class Link(db.Model):
	name = db.StringProperty(required=True)
	url = db.StringProperty(required=True)
	title = db.StringProperty(required=True)

class Setting(db.Model):
	name = db.StringProperty(required=True)
	value = db.StringProperty(required=True)
	miaoshu = db.StringProperty(required=True)
	type = db.StringProperty(required=True, default='string', choices=['int','string'])
